import { IndexDto, ShowDto } from '@libs/common/dto';
import { ApiProperty, PartialType } from '@nestjs/swagger';
import { IsBoolean, IsNotEmpty } from 'class-validator';

import { DepartmentConfig } from '../entities/department-config.entity';

export class IndexDepartmentConfigDto extends IndexDto<DepartmentConfig> {}

export class ShowDepartmentConfigDto extends ShowDto {}

export class UpdateDepartmentConfigDto extends PartialType(
  IndexDepartmentConfigDto,
) {
  @ApiProperty()
  @IsNotEmpty({ message: 'id 不能为空' })
  id: string;
}

export class SwitchDepartmentConfigDto {
  @ApiProperty()
  @IsNotEmpty({ message: 'id不能为空' })
  id: string;

  @ApiProperty({ description: '添加积分需要通知部门' })
  addPointsNotice: DepartmentConfig['addPointsNotice'];

  @ApiProperty({ description: '是否可以查询工时权限' })
  enableOvertimeAuth: DepartmentConfig['enableOvertimeAuth'];
}

export class FindDepartmentConfigDto extends PartialType(
  SwitchDepartmentConfigDto,
) {
  /** 添加积分是否通知 */
  addPointsNotice?: 0 | 1;

  @ApiProperty({ description: '状态' })
  status?: DepartmentConfig['status'];
}
